function ex1()
% Sample function that runs everything for excersise 1
    [Train Test] = plotData();
    fprintf('Press any button to continue');
    waitforbuttonpress;

    % Instantiate mean, std and class prob.
    Mu = ones(2, 2);
    Sigma = ones(2, 2);
    PC = ones(2);

    % Mean:
    Mu(1, :) = mean(Train(find(Train(:, 3)), 1:2));
    Mu(2, :) = mean(Train(find(Train(:, 4)), 1:2))

    % Sigma:
    Sigma(1, :) = std(Train(find(Train(:, 3)), 1:2));
    Sigma(2, :) = std(Train(find(Train(:, 4)), 1:2))

    %Class probability:
    PC(1) = sum(Train(:, 3)) ./ size(Train, 1);
    PC(2) = sum(Train(:, 4)) ./ size(Train, 1)

    % Now test. This part should actually divide by a constant, but we're not
    % interested in the real probabilities, just in which one is bigger.
    size(Test(:, 1:2))
    PTest = ones(size(Test(:, 1:2)));
    PTest(:, 1) = mvnpdf(Test(:, 1:2), Mu(1, :), Sigma(1, :)) * PC(1);
    PTest(:, 2) = mvnpdf(Test(:, 1:2), Mu(2, :), Sigma(2, :)) * PC(2);

    % initialize confusion matrix:
    tp1 = 0;
    tf1 = 0;
    tp2 = 0;
    tf2 = 0;

    for i=1:size(PTest, 1)
        % If classiffier says class = 1 and class actually is 1:
        if(PTest(i, 1) > PTest(i, 2))
            if(Test(i, 3))
                tp1 = tp1 + 1;
            else
                tf1 = tf1 + 1;
            end
        elseif(PTest(i, 2) >= PTest(i, 1))
            if(Test(i, 4))
                tp2 = tp2 + 1;
            else
                tf2 = tf2 + 1;
            end
        end
    end
    sprintf('true class1:\t\t%d\nfalse class1:\t%d\ntrue class2:\t\t%d\nfalse class2:\t%d\ncorrectly classified:\t%.2f%\n', tp1, tf1, tp2, tf2, ((tp1+tp2) / (tp1+tf1+tp2+tf2))*100)    
end

